home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-11 | 7.7 KB | 307 lines | [TEXT/ALFA] |
- # The following flags affect Think's "Run" command.
- # THINK will crash if you set the debugger flag and your
- # project does not have debugging information.
- if {![info exists thinkdebugger]} {set thinkdebugger 0}
- if {![info exists thinkgo]} {set thinkgo 1}
- if {![info exists thinksaveDirty]} {set thinksaveDirty 1}
- if {![info exists thinkupdate]} {set thinkupdate 1}
-
- menu -n thinkFlags -p thinkFlagsProc {"debugger" "go" "saveDirty" "update"}
- markMenuItem thinkFlags debugger $thinkdebugger
- markMenuItem thinkFlags go $thinkgo
- markMenuItem thinkFlags saveDirty $thinksaveDirty
- markMenuItem thinkFlags update $thinkupdate
-
- proc thinkFlagsProc {menu item} {
- global think$item modifiedVars
-
- set think$item [expr -1 * ([set think$item] - 1)]
- markMenuItem thinkFlags $item [set think$item]
- lappend modifiedVars think$item
- }
-
- set THINK "THINK Project Manager"
- #set THINK "AEvent Display 1.3"
-
-
- proc thinkNumFiles {} {
- global THINK
- set str [AEBuild -r $THINK "core" "cnte" "----" {obj{want:type('PDOC'), from:'null'(), form:'indx', seld:1}} "kocl" "type('SFIL')"]
- if {[regexp {[0-9]+} $str mtch]} {
- return $mtch
- } else {
- error "Bad numfiles"
- }
- }
-
-
-
- # Get list of files in current project.
- proc projectFileList args {
- watchCursor
- checkRunning ThinkC KAHL thinkName
- set num [thinkNumFiles]
- set files {}
-
- for {set i 1} {$i<=$num} {incr i} {
- set f [thinkFileName $i]
- set l [ls -l $f]
- if {[lindex $l 7] == "TEXT"} {
- lappend files $f
- }
- }
-
- return $files
- }
-
-
-
-
- #================================================================================
-
-
- proc think {} {
- set name [checkRunning ThinkC KAHL thinkName]
- if {![string length $name]} return
- switchTo $name
- }
-
- proc searchNextFile {} {
- thinkFinf
- }
-
-
-
- #===========================================================================
- # Add fileset.
- #===========================================================================
- proc createThinkFileset {} {
- global fileSets
- global currFileSet
-
- set name [prompt "Fileset name? " "THINK"]
- set fileSets($name) [projectFileList]
- addMenuItem -m choose $name
- set currFileSet $name
-
- if {[askyesno "Save project fileset?"] == "yes"} {
- addUserLine "set \"fileSets($name)\" \{$fileSets($name)\}"
- }
- makeFilesetMenu
- }
-
- #================================================================================
-
- proc compile {} {
- sendCompileEvent CMPL "-r"
- }
-
- proc checkSyntax {} {
- sendCompileEvent SNTX "-q"
- }
-
- proc disassemble {} {
- global THINK ALPHA
- set tname [checkRunning ThinkC KAHL thinkName]
- set name [lindex [winNames -f] 0]
- switchTo $tname
- set res [AEBuild -t 7200 -r $tname KAHL DASM CFLG long(32) "----" [fileObject $name]]
- switchTo $ALPHA
- new -n "* [file root [file tail $name]].asm *"
- regexp {“.*”} $res text
- insertText [string trim $text {“”}]
- setWinInfo dirty 0
- goto 0
- }
-
- proc preprocess {} {
- global THINK ALPHA
- set tname [checkRunning ThinkC KAHL thinkName]
- set name [lindex [winNames -f] 0]
- switchTo $tname
- set res [AEBuild -r $tname KAHL PRCS CFLG long(32) "----" [fileObject $name]]
- switchTo $ALPHA
- new -n "* Preprocessed '[file tail $name]' *"
- regexp {“.*”} $res text
- insertText [string trim $text {“”}]
- }
-
-
- proc sendCompileEvent {event arg} {
- global THINK ALPHA
- set tname [checkRunning ThinkC KAHL thinkName]
- set name [lindex [winNames -f] 0]
- switchTo $tname
- if {[string length $arg]} {
- set res [AEBuild -t 7200 $arg $tname KAHL $event "----" [fileObject $name]]
- } else {
- set res [AEBuild -t 7200 $tname KAHL $event "----" [fileObject $name]]
- }
- switchTo $ALPHA
- return $res
- }
-
-
- proc add {} {
- global THINK
- set fname [lindex [winNames -f] 0]
- AEBuild $THINK core crel "data" [makeAlis $fname] "kocl" "type('SFIL')"
- }
-
- proc addAndCompile {} {
- add
- compile
- }
-
-
- proc precompile {} {
- sendCompileEvent PCMP ""
- }
-
- proc bringUpToDate {} {
- global THINK ALPHA
- set name [checkRunning ThinkC KAHL thinkName]
- switchTo $name
- set res [AEBuild -q $name KAHL CMPL SLCT MAKE "CFLG" "long(2)" "----" {obj{want:type('PDOC'), from:'null'(), form:'indx', seld:1}}]
- switchTo $ALPHA
- return $res
- }
-
- proc make {} {
- global THINK ALPHA
- set name [checkRunning ThinkC KAHL thinkName]
- switchTo $name
- set res [AEBuild -q $name KAHL CMPL SLCT MAKE "CFLG" "long(2)" "----" {obj{want:type('PDOC'), from:'null'(), form:'indx', seld:1}}]
- }
-
- proc run {} {
- global THINK thinkdebugger thinkgo thinksaveDirty thinkupdate
-
- set name [checkRunning ThinkC KAHL thinkName]
- set dbug [expr {$thinkdebugger ? "bool(«01»)" : "bool(«00»)"}]
- set go [expr {$thinkgo ? "bool(«01»)" : "bool(«00»)"}]
- set update [expr {$thinkupdate ? "'yes '" : "'no '"}]
- set dirty [expr {$thinksaveDirty ? "'yes '" : "'no '"}]
- switchTo $name
- AEBuild -q $name KAHL "RUN " "DBUG" $dbug "GO " $go "UPDT" $update "savo" $dirty
- }
-
- proc debug {} {
- global THINK
- set fname [lindex [winNames -f] 0]
- set row [expr [lindex [posToRowCol [getPos]] 0] - 1]
- set res [AEBuild $THINK KAHL DBGF "----" [makeAlis $fname] LNNO "short($row)" ]
- }
-
- proc cnt {} {
- global THINK
- AEBuild -t 6000 -r $THINK core cnte "----" {obj{want:type('PDOC'), from:'null'(), form:'indx', seld:1}} "kocl" "type('sfil')"
- }
-
- proc thinkFileName {arg} {
- global THINK
- set event [join [concat {obj\ \{want:type('prop'),\ from:obj\ \{want:type('SFIL'),\ from:'null'(),\ form:'indx',\ seld:} $arg {\},\ form:'prop',\ seld:type('FSS\ ')\}}] ""]
- set blah [AEBuild -r $THINK "core" "getd" "----" $event]
- regexp {«.*»} $blah blah
- return [specToPathName [string trim $blah {«»}]]
- }
-
- proc thinkInclude {name} {
- global THINK thinkpaths
- if {[info exists thinkpaths]} {unset thinkpaths}
- set event [join [concat {obj\ \{want:type('prop'),\ from:obj\ \{want:type('SFIL'),\ from:'null'(),\ form:'name', seld:“} [file tail $name] {”\},\ form:'prop',\ seld:type('INCL')\}}] ""]
- set blah [AEBuild -r $THINK "core" "getd" "----" $event]
- if {![regexp {«} $blah]} {return {{(No includes}}}
- regsub -all {»[^«]*«} $blah { } raw
- regsub {[^«]*«} $raw {} raw
- regsub {».*} $raw {} raw
- foreach f $raw {
- set path [specToPathName $f]
- set tl [file tail $path]
- set thinkpaths($tl) $path
- lappend names $tl
- }
- return [lsort -ignore $names]
- }
-
- # Called by Alpha to get list of include files for popup.
- proc thinkIncludeFiles {} {
- if {[catch {thinkInclude [lindex [winNames] 0]} ret]} {
- return {{(* THINK not running *}}
- }
- return $ret
- }
-
- # Called by Alpha to edit result of popup
- proc thinkEditFile {name} {
- global thinkpaths
-
- edit $thinkpaths($name)
- }
-
- proc openHeader {} {
- global thinkpaths
-
- set name [lindex [winNames] 0]
- if {![string length $name]} return
- if {[catch {thinkInclude $name} names]} {
- message "Think not running!"
- beep
- return
- }
- if {![string length $name] || [string match {(*} [lindex $names 0]]} {
- message "No headers."
- beep
- return
- }
- set res [listpick -p {Include File?} $names]
- if {[string length $res]} {edit $thinkpaths($res)}
- }
-
-
- proc removeDups {l} {
- foreach f $l {
- set silly($f) 1
- }
- if {[info exists silly]} {
- return [array names silly]
- }
- }
-
- #================================================================================
-
- proc handleThinkReply { l } {
- global thinkErrors teIndex ALPHA tileHeight winModes terrMenu
- set thinkErrors $l
- switchTo $ALPHA
- set teIndex 0
-
- global defHeight defLeft defTop defWidth
- set sl $defLeft
- set st $defTop
- set sh $defHeight
- set sw $defWidth
- set defHeight 140
- set defWidth 510
- set defLeft 3
- set defTop 40
-
- foreach err $l {
- append lines "\"[file tail [lindex $err 0]]\"; " [format "Line %d: " [lindex $err 2]] [lindex $err 1] "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t∞[lindex $err 0]∞[lindex $err 1]\r"
- }
-
- new
- set defLeft $sl
- set defTop $st
- set defHeight $sh
- set defWidth $sw
-
- insertText "(<cr> to go to error)\r-----\r" $lines
- select [nextLineStart [nextLineStart 0]] [nextLineStart [nextLineStart [nextLineStart 0]]]
-
- global winModes
- set name [lindex [winNames] 0]
- changeMode [set winModes($name) Brws]
- }
-
-